/*
 * Copyright 2013 Agustina Martinez-Garcia

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package uk.da.dext.datastructs;

import java.util.ArrayList;
import java.util.List;

public class MemoStruct {
    	private String memoPid;
	private String memoText;
	private String memoDocumentRef;
	private String memoXmlId;
	private String memoLabel;
	private String memoLanguage;
	/**
	 * Holds a list of the associated document references with a given category
	 * In this case each document reference will be the row number of the referenced document
	 * Shouldn't it has to be the document generated XML IDs?????
	 */
	private List<String> documentRefs;
	/**
	 * Documents XML IDs, not the Fedora PIDs, this is needed when generating the Qudex instances
	 */
	private List<String> documentRefsXmlIds;
	/**
	 * @param memoText the memoText to set
	 */
	public void setMemoText(String memoText) {
		this.memoText = memoText;
	}
	/**
	 * @return the memoText
	 */
	public String getMemoText() {
		return memoText;
	}
	/**
	 * @param memoDocumentRef the memoDocumentRef to set
	 */
	public void setMemoDocumentRef(String memoDocumentRef) {
		this.memoDocumentRef = memoDocumentRef;
	}
	/**
	 * @return the memoDocumentRef
	 */
	public String getMemoDocumentRef() {
		return memoDocumentRef;
	}
	/**
	 * @param memoXmlId the memoXmlId to set
	 */
	public void setMemoXmlId(String memoXmlId) {
		this.memoXmlId = memoXmlId;
	}
	/**
	 * @return the memoXmlId
	 */
	public String getMemoXmlId() {
		return memoXmlId;
	}
	/**
	 * @param memoLabel the memoLabel to set
	 */
	public void setMemoLabel(String memoLabel) {
		this.memoLabel = memoLabel;
	}
	/**
	 * @return the memoLabel
	 */
	public String getMemoLabel() {
		return memoLabel;
	}
	
	/**
	 * @return the documentRefs
	 */
	public List<String> getDocumentRefs() {
		return documentRefs;
	}
	/**
	 * @param documentRefs the documentRefs to set
	 */
	public void setDocumentRefs(List<String> documentRefs) {
		this.documentRefs = documentRefs;
	}
	/**
	 * @return the documentRefsXmlIds
	 */
	public List<String> getDocumentRefsXmlIds() {
		return documentRefsXmlIds;
	}
	/**
	 * @param documentRefsXmlIds the documentRefsXmlIds to set
	 */
	public void setDocumentRefsXmlIds(List<String> documentRefsXmlIds) {
		this.documentRefsXmlIds = documentRefsXmlIds;
	}
	public MemoStruct(String label) {
		this.memoLabel = label;
		this.documentRefs = new ArrayList<String>();
		this.documentRefsXmlIds = new ArrayList<String>();
		this.memoXmlId = "";
		this.memoLanguage = "";
	}
	
	public MemoStruct() {
		this.memoLabel = "";
		this.documentRefs = new ArrayList<String>();
		this.documentRefsXmlIds = new ArrayList<String>();
		this.memoXmlId = "";
		this.memoLanguage = "";
	}
	/**
	 * Clears all the elements from the lists managed by the code object:
	 * list of parents, list of children and list of document references
	 */
	public void clearMemoLists() {
		this.documentRefs.clear();
		this.documentRefsXmlIds.clear();
	}
	/**
	 * @param memoLanguage the memoLanguage to set
	 */
	public void setMemoLanguage(String memoLanguage) {
		this.memoLanguage = memoLanguage;
	}
	/**
	 * @return the memoLanguage
	 */
	public String getMemoLanguage() {
		return memoLanguage;
	}
	/**
	 * Finds a document reference within the list of document references of a particular memo
	 * @param docRef name of the document reference to find
	 * @return true if element present
	 */
	public boolean findDocumentRef(String docRef) {
		return this.documentRefs.contains(docRef);
	}
	/**
	 * @param memoPid the memoPid to set
	 */
	public void setMemoPid(String memoPid) {
	    this.memoPid = memoPid;
	}
	/**
	 * @return the memoPid
	 */
	public String getMemoPid() {
	    return memoPid;
	}
}
